<%@ page language="java" contentType="text/html; charset=UTF-8"
    pageEncoding="UTF-8"%>
<%@page import="com.qs.po.*"%>
<%@page import="com.qs.vo.*"%>
<%@page import="com.qs.enums.*"%>
<%@page import="com.qs.service.*"%>
<%@page import="com.infomanage.po.*"%>
<%  response.addDateHeader("Expires", 0);response.setHeader("Pragma","no-cache"); response.setHeader("Cache-Control","no-cache");%>
<%
    request.setCharacterEncoding("UTF-8");
	String itemId = request.getParameter("itemId");
    if(itemId == null) itemId = "";
    
    QsRpTestItem item = RescurePrepareTestService.load(request, response, out);
    int deptId = -1;
    String deptname = "";
    int trainee = -1;
    String traineeName = "";
    int personId = -1;
    String personName = "";
    float score = 0;
    int dutyPersonCount = 0;
    int actionTime = 0;
    String timestamp = "";
    if(item != null) {
    	QsRpTest bean = item.getBean();
		Department dept = item.getDept();
		Person traineeBean = item.getPerson();
		Person person = item.getPerson();
		personName = person.getName();
		deptId = dept.getDeptId();
		deptname = dept.getName();
		trainee = traineeBean.getPersonId();
		traineeName = traineeBean.getName();
		timestamp = bean.getTimestamp();
		actionTime = bean.getActionTime();
		dutyPersonCount = bean.getDutyPersonCount();
		score = bean.getScore();
    } 
%>

<html>
<head>
	<title>救援准备训练</title>
	<link href="<%=request.getContextPath() %>/css/style.css" rel="stylesheet" type="text/css">
	<link href="<%=request.getContextPath() %>/css/table.css" rel="stylesheet" type="text/css">
	<link href="<%=request.getContextPath() %>/css/calendar.css" rel="stylesheet" type="text/css">
	<script type="text/javascript" src="<%=request.getContextPath() %>/js/calendar.js"></script>
	<script type="text/javascript" src="<%=request.getContextPath() %>/js/common.js"></script>
	<script type="text/javascript">
	 function init() {
		   if("" != "<%=itemId%>") { // 修改
			   form1.deptId.value = "<%=deptId%>";
			   form1.deptname.value = "<%=deptname%>";
		       
		   	   form1.trainee.value = "<%=trainee%>";	
			   
		       form1.traineeName.value = "<%=traineeName%>";	
		   }
	   }
	   // 提交
	   function doSubmit(){
	   		if(validate()){
	   			return;
	   		}
		 	if("" == "<%=itemId%>") {
		 		form1.actionType.value = "add";
			}else {
		 		form1.actionType.value = "modify";
			}
		 	form1.submit();
	   }

		function validate(){
	   		if(form1.deptId.value == ""){
	   			alert("小队不能为空！");
	   			return true;
	   		}

	   		if(form1.timestamp.value == ""){
	   			alert("日期不能为空！");
	   			return true;
	   		}
	   		
	   		if(form1.trainee.value == ""){
	   			alert("参训人不能为空！");
	   			return true;
	   		}
	   		if(form1.score.value == ""){
	   			alert("得分不能为空！");
	   			return true;
	   		}
	   		return false;
	   }
	   
	   function showError(error){
		   alert(error);
	   }

	   function showInfo(info){
		   alert(info);
		   window.returnValue = "ok";
		   window.close();
	   }
	</script>
</head>
<body  rightmargin="0" bottommargin="0" leftmargin="0" topmargin="0" onclick="clickBody();" onload="init();">
	<form name="form1" action="rescuePrepare_action.jsp" method="post" target="actionFrame">
	<input type="hidden" name="itemId" value="<%=itemId%>">
	<input type="hidden" name="actionType">
	<table class="dialogTable" cellpadding="0" cellspacing="0">
		<!-- 表头-->
		<tr class="dialogTableHeader">
			<td>救援准备训练</td>
		</tr>
		<!-- 表数据-->
		<tr class="dialogTableContent">
			<td>
				<!-- 数据项 -->
				<table class="dataTable">
					<col width="30%">
					<col width="70%">
					<tr>
						<td class="field">
							小队
						</td>
						<td>
							<span class="treeSpan" onclick="showTree(this, '<%=request.getContextPath() %>/infomanage/common/deptTree.jsp');" treeSelect="true">
								<input name="deptname" style="width: 100%;" readonly="readonly" 
								treeSelect="true"><input name="deptId"  type="hidden">
							</span>
						</td>
					</tr>
					<tr>
						<td class="field">
							日期
						</td>
						<td>
							<input value= "<%=timestamp %>" type="text" name="timestamp" style="width: 230px;cursor: hand;" id="time" onClick="return showCalendar(this.id, 'y-mm-dd');" readonly="readonly"><img 
									src="<%=request.getContextPath() %>/img/tip_calender.gif" style="cursor: hand;" width="16" height="16" onClick="return showCalendar('time', 'y-mm-dd');">
						</td>
					</tr>
					<tr>
						<td  class="field">
							参训人
						</td>
						<td>
							<span class="treeSpan" onclick="showTree(this, '<%=request.getContextPath() %>/infomanage/common/personTree.jsp');" treeSelect="true">
								<input name="traineeName"  style="width: 100%;" readonly="readonly" 
								treeSelect="true"><input name="trainee"  type="hidden">
							</span>
						</td>
					</tr>
					<tr>
						<td class="field">
							值班人数
						</td>
						<td>
							<input value="<%=dutyPersonCount %>" name="dutyPersonCount" style="width: 100%;"/>
						</td>
					</tr>
					<tr>
						<td class="field">
							出动时间
						</td>
						<td>
							<input value="<%=actionTime %>" name="actionTime" style="width: 100%;"/>
						</td>
					</tr>
					<tr>
						<td class="field">
							得分
						</td>
						<td>
							<input value="<%= score%>"  name="score" style="width: 100%;"/>
						</td>
					</tr>
					<tr>
						<td class="field">
							满分
						</td>
						<td>
							10
						</td>
					</tr>
					<tr >
						<td class="field">
							评分标准
						</td>
						<td height="100px">
							a）少于6人或未进行24小时值班，该项无分。<br/>
							b）不打预备铃扣0.2分。<br/>
							c）出动时间超过规定，扣1分。
						</td>
					</tr>
				</table>
			</td>
		</tr>
		<tr>
			<td colspan="2" class="tableBtn">
				<span onclick="doSubmit();">确定</span>
				<span onclick="window.close();">取消</span>
			</td>
		</tr>
		<tr valign="top">
			<td colspan="2">
				&nbsp;
			</td>
		</tr>
	</table>
	</form>
	<iframe src="#" frameborder="0" id="treeFrame" name="frame" style="display: none;position: absolute;"></iframe>
	<iframe src="#" name="actionFrame" style="display: none;"></iframe>
</body>
</html>